#pragma once

#include  "iostream"
#include  "vector"
#include  "stack"
#include  "unordered_map"
#include   "queue"

using namespace std;


int removeDuplicates(vector<int> &nums) {

    int index = 1;
    int count = 1;
    for (int i = 1; i < nums.size(); i++) {
        if (nums[i] != nums[i - 1]) {
            nums[index++] = nums[i];
            count = 1;
        } else if (count < 2) {
            count++;
            nums[index++] = nums[i];
        }

    }

    return index;
}